<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/admin/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/static/admin/lib/jq-module/zyupload/zyupload-1.0.0.min.css" media="all">
    <link rel="stylesheet" href="/static/admin/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form">
            <div class="layui-form-item">

                <div class="layui-form-item">
                    <label class="layui-form-label">行政名称</label>
                    <div class="layui-input-inline">
                        <input type="text" name="boroughs_name" lay-verify="required" autocomplete="off" class="layui-input" value="{$info.boroughs_name}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">所属上级</label>
                <div class="layui-input-inline">
                    <select name="pid" lay-verify="required" lay-search="">
                        <option value="0" {if $info.pid == 0}selected{/if}>顶级行政</option>
                        {if !empty($bors)}
                        {volist name="$bors" id="bs"}
                        <option value="{$bs.boroughs_id}" {if $info.pid == $bs.boroughs_id}selected{/if} >{$bs.boroughs_name}</option>
                        {/volist}
                        {/if}
                    </select>
                </div>
            </div>

            <input type="hidden" name="boroughs_id" value="{$info.boroughs_id}">

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" type="button" lay-submit="" lay-filter="zz_edit">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="/static/admin/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script src="/static/admin/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/admin/lib/jq-module/zyupload/zyupload-1.0.0.min.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['form','upload'], function () {
        var form = layui.form
            , layer = layui.layer
            , $ = layui.jquery;



        //监听提交
        form.on('submit(zz_edit)', function (data) {
            data = data.field;
            $.ajax({
                url : '/back/boroughs/edit',
                data :data,
                type:'POST',
                success:function(res){
                    if(res.code == 1){
                        layer.msg(res.msg,{icon:1,time:2000},function(){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                        });
                    }else{
                        layer.msg(res.msg,{icon:2});
                    }

                }
            });
            return false;
        });



    });
</script>

</body>
</html>